const promise = new Promise((resolve, reject) => {
    setTimeout(() => {
        console.log("异步任务完成");
        resolve();
    }, 1000);
});

//promise.then(() => {
  //  console.log('soooooo good');
//});

//new Promise((resolve, reject) => {
 //   setTimeout(() => {
   //     resolve({name: 'Chen', age: 22 });
        //console.log('Everything are best for me');
    //}, 1000);
//}).then((user) => console.log(user));

const getUser = new Promise((resolve, reject) => {
    setTimeout(() => {
        let error = true;

        if(!error) {
            resolve({ name: 'Lin', age: 22 });
        } else {
            reject('1： soooo badly');
        }
    }, 1000);
});

getUser
.then((user) => console.log(user))
.catch((error) => console.log(error))
.finally(() => console.log('i am a rich girl'));

console.log('fuck everything');